const allTpl = require('../views/allpage.html')

import concert  from '../controller/concert';
import opera    from '../controller/opera';
import music    from '../controller/music';
import physical from '../controller/physical';
import comic    from '../controller/comic';
import parent   from '../controller/parentchild';
import relax    from '../controller/relax';
import oversea  from '../controller/oversea';
class RenderConcert{
    constructor(){
        
       
        
        // console.log($(`.all-content-title li[data-hash=${gethash}]`));
    }
    render(){
        $("#root").html(allTpl);
        this.setActive();
        this.addClassifyEvent();
    }

    addClassifyEvent(){
        $(".all-content-title li").on("click",function() {
            //console.log(this);
            let dmhash = $(this).attr('data-hash');
            location.hash = dmhash;
            //console.log(dmhash);
        })
    }


    setActive(){
        let gethash = location.hash && location.hash.substr(1);
        // console.log(document.querySelector(".all-content-title"));
        // console.log(gethash);
        // console.log($(".all-content-title"))
        $(`.all-content-title li[data-hash=${gethash}]`).addClass('active').siblings().removeClass('active');
    }


    renderConcertPage(){
        concert.render();
    }
    
    renderOpera(){
        opera.render();
    }

    renderMusic(){
        music.render();
    }
    renderPhysical(){
        physical.render();
    }
    renderComic(){
        comic.render();
    }
    renderParent(){
        parent.render();
    }
    renderRelax(){
        relax.render();
    }
    renderOversea(){
        oversea.render();
    }
}

export default new RenderConcert();